<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-06-17 11:21:46
 * @LastEditors: charles
 * @LastEditTime: 2021-06-17 11:28:23
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组</title>
</head>
<body>
  <script>
    let arr = [
      "terry",
      true,
      1,
      2,
      3,
      {name:"terry"}
    ]
    console.log("数组长度",arr.length);
    console.log("数组最后一个元素",arr[arr.length]);
    console.log("数组最后一个元素",arr[arr.length-1]);

    for(var k in arr){
      let v = arr[k]
      console.log(k,v);
    }

    for(var i = 0;i<arr.length;i++){
      let v = arr[i];
      console.log(i,v);
    }
    // api
    arr.push(false);
    console.log(arr);
  </script>
</body>
</html>